<%@page import="org.ipo.mm.web.util.pager.AbstractPager, org.ipo.mm.web.util.ConstantManager, java.util.Collection, org.ipo.mm.web.util.security.SecurityManager, java.util.Vector" %>
<%@page contentType="text/html;charset=utf-8" pageEncoding="UTF-8" %>
<%@taglib prefix="l" uri="http://struts.apache.org/tags-logic" %>
<%@taglib prefix="b" uri="http://struts.apache.org/tags-bean" %>
<%@taglib prefix="h" uri="http://struts.apache.org/tags-html"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>




<h1><b:message key="menu_log"/></h1>


<div class="tabela">
    <table width="100%" border="0" >
        <tr>
            <th scope="col"><b:message key="log_action"/></th>
            <th scope="col"><b:message key="log_time"/></th>
            <th scope="col"><b:message key="log_user"/></th>
        </tr>

        <l:iterate id="log" name="LOG_SEARCH_RESULTS" scope="request">
            <tr class="red1"><!--treba da ide red2 u svakom drugom-->
                <td>
                    <b:write name="log" property="action"/>
                </td>
                <td>
                    <b:write name="log" property="time"/>
                </td>
                <td>
                     ${log.userId.username}
                </td>

            </tr>
        </l:iterate>
        <tr>
            <th scope="col"><b:message key="log_action"/></th>
            <th scope="col"><b:message key="log_time"/></th>
            <th scope="col"><b:message key="log_user"/></th>
        </tr>
    </table>
</div><!--tabela-->

<div id="navigation">

    <% AbstractPager pager = (AbstractPager) request.getSession().getAttribute(ConstantManager.SESSION_LOG_PAGER);%>

    <c:if test="${LOG_SEARCH_SHOW_PREV}">

        <a href="<%= request.getContextPath() + "/protected/log_search.do?method=showMeetings&p=" + (pager.getPageNumber() - 1)%>" class="previous"><b:message key="gen_previous"/></a>

    </c:if>

    <%-- padajuca lista sa brojevima strana --%>

    <select name="URL" onchange="window.location=this.options[selectedIndex].value">
        <%

            Vector<Integer> pagenumbers = (Vector<Integer>) request.getAttribute("LOG_SEARCH_PAGENUMBERS");
            if (pagenumbers != null) { // is quicksearch is used then there is no paging
                for (int i = 0; i < pagenumbers.size(); i++) {
                    int pageParam = pager.getPageNumber();
                    int pageNumber = pagenumbers.get(i);

                    if (pageParam == pageNumber) {
                        out.write("<option value=\"" + request.getContextPath() + "/protected/log_search.do?method=showMeetings&p=" + pageNumber + "\" selected=\"selected\">" + pageNumber + "</option>");
                    } else {
                        out.write("<option value=\"" + request.getContextPath() + "/protected/log_search.do?method=showMeetings&p=" + pageNumber + "\">" + pageNumber + "</option>");

                    }


                }
            }

        %>

    </select>

    <%-- end padajuca lista sa brojvima strana --%>


    <c:if test="${LOG_SEARCH_SHOW_NEXT}">

        <a href="<%= request.getContextPath() + "/protected/log_search.do?method=showMeetings&p=" + (pager.getPageNumber() + 1)%>" class="next"><b:message key="gen_next"/></a>
    </c:if>


</div>
